<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="background-color: rgba(255,255,255,1);">

	<head>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>html5曲线柱形统计图表代码 - xw素材网</title>
		<link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
		<script type="text/javascript" src="jQuery.js"></script>
		<script type="text/javascript" src="jqplot.js"></script>
		<script src="//cdn1.lncld.net/static/js/2.1.2/av-min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/swiper.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="main" style="background-color: rgba(255,255,255,1);">
			<div class="header">
				<i class="icon Hui-iconfont" onclick="history.go(-1)">&#xe67d;</i>
				<div class="title">
					<span>职位列表</span>
				</div>
			</div>
			<div style="margin-bottom: 30px;"></div>
			<div class="swiper-container">
				<div class="swiper-wrapper">
					<div class="swiper-slide">
						<div id="chart1"></div>
					</div>
					<div class="swiper-slide">
						<div id="chart2"></div>
					</div>
				</div>
			</div>
		</div>
		<div class="foot">
			<div class="home">
				<a href="../home/home.html">
					<i class="icon Hui-iconfont">&#xe625;</i>
					<span>首页</span>
				</a>
			</div>
			<div class="mylagou">
				<a href="../mine/mine.html">
					<i class="icon Hui-iconfont">&#xe705;</i>
					<span>我的</span>
				</a>
			</div>
			<div class="userFeedback">
				<a href="../liaotian/liaotian.html">
					<i class="icon Hui-iconfont">&#xe622;</i>
					<span>在线咨询</span>
				</a>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var mySwiper = new Swiper('.swiper-container', {}) //初始化swiper
		init();
		var currentUser = AV.User.current();
		var userid = currentUser.id; //获取用户id
		console.log(userid);

		//设置日期，当前日期的前七天
		var myDate = new Date(); //获取今天日期
		myDate.setDate(myDate.getDate() - 6);
		var dateArray = [];
		var dateTemp;
		var flag = 1;
		var queryDelivery = new AV.Query('delivery');
		queryDelivery.equalTo('userid', userid);
		var i = 0;
		seven();

		function seven() {
			var month = (myDate.getMonth() + 1) < 10 ? "0" + (myDate.getMonth() + 1) : (myDate.getMonth() + 1);
			var day = myDate.getDate() < 10 ? "0" + myDate.getDate() : myDate.getDate();
			dateTemp = myDate.getFullYear() + "-" + month + "-" + day;

			myDate.setDate(myDate.getDate() + flag);
			var query1 = new AV.Query('delivery');
			query1.equalTo('update', dateTemp); //按日期查询
			var query = AV.Query.and(queryDelivery, query1);
			query.count().then(function(count) { //统计数量
				console.log(count);
				dateArray.push(count);
			}, function(error) {
				console.log("error")
			}).then(function() {
				i++;
				if(i < 7) {
					seven();
				} else { //查询完成
					console.log(dateArray);
					var data = [
						dateArray,
					];
					var data_max = 10; //Y轴最大刻度
					var line_title = ["投递个数", "B"]; //曲线名称
					var y_label = "投递次数"; //Y轴标题
					var x_label = "第几天"; //X轴标题
					var x = [1, 2, 3, 4, 5, 6, 7]; //定义X轴刻度值
					var title = "这是标题"; //统计图标标题
					j.jqplot.diagram.base("chart1", data, line_title, "最近7天简历投递情况", x, x_label, y_label, data_max, 1);
					j.jqplot.diagram.base("chart2", data, line_title, "最近7天简历投递情况", x, x_label, y_label, data_max, 2);
				}
			});
		}
	</script>

</html>